﻿using System;
using System.Collections.Generic;
using viBlog.Classes;
using viBlog.Controllers;
using visinia.SmartEngine;
using visinia.SmartEngine.SiteMap;

namespace viBlog.HttpHandlers
{
    public class SiteMap : BaseSiteMap
    {
        public override List<SiteMapInfo> GenerateSiteMap()
        {
            List<SiteMapInfo> list = new List<SiteMapInfo>();
            // blog front page
            string blogFrontpageUrl = WebRoots.GetWebRoot + BlogController.BlogUrlSeparator + ".aspx";
            list.Add(new SiteMapInfo("viBlog",BlogController.BlogName, blogFrontpageUrl, DateTime.Now, SiteMapInfo.ChangeFreq.Daily));
           
            // Posts
            PostController.GetPosts().ForEach(delegate(Post post)
            {
                list.Add(new SiteMapInfo("viBlog", post.Title, post.Url, post.Date, SiteMapInfo.ChangeFreq.Monthly));                
            });
            return list;
        }
    }
}
